const { PDFPrinter } = require("@myteril/node-win-printer");

const Printer = new PDFPrinter({
  sumatraPdfPath: "./SumatraPDF.exe",
});

console.log(Printer);

const { getPrinters } = require("@myteril/node-win-printer");

async function main() {
  const PrinterInfoList = await getPrinters();

  //   console.log(PrinterInfoList);
  const printerMap = PrinterInfoList.reduce((acc, printer) => {
    acc[printer.Caption] = {
      ...printer,
    };
    return acc;
  }, {});

  const printerNames = Object.keys(printerMap);

  console.log(printerNames);
  console.log(printerMap["Microsoft Print to PDF"]);

  Printer.print({
    file: "./test.pdf",
    printer: "Microsoft Print to PDF",
    scale: "none",
  });
}

main();
